//
//  HomeWebViewController.m
//  MyHome
//
//  Created by DHSoft on 16/8/31.
//  Copyright © 2016年 DHSoft. All rights reserved.
//

#import "HomeWebViewController.h"
#import <WebKit/WKWebView.h>

@interface HomeWebViewController ()

@end

@implementation HomeWebViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupNavView];
    [self HomeWebView];
}

- (void)setupNavView{
    [self.navView.leftButton setImage:IMAGE(@"navigation_back") forState:UIControlStateNormal];
    [self.navView.centerButton setTitle:@"广告" forState:UIControlStateNormal];
    [self.navView.leftButton addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
}

- (void)HomeWebView {
    WKWebView *webView = [[WKWebView alloc]initWithFrame:CGRectMake(0, kTopBarHeight, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height)];
    [self.view addSubview:webView];
    
    
    NSURL *url = [NSURL URLWithString:self.urlStr];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    
    [webView loadRequest:request];
}

- (void)back {
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (NSString *)urlStr {
    if(_urlStr == nil) {
        _urlStr = [NSString string];
    }
    return _urlStr;
}

@end
